<%--
  Created by IntelliJ IDEA.
  User: xie392
  Date: 2023/6/8
  Time: 0:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
  Object obj = session.getAttribute("email");
  out.println("<script>console.log('" + obj + "')</script>");
  out.println("<script>console.log('" + response + "')</script>");
  // 如果没有登录且不是登录页面或注册页面
  if (obj == null && !request.getRequestURI().endsWith("login.jsp") &&  !request.getRequestURI().endsWith("register.jsp")) {
    out.println("<script>Toast('请先登录！'); location.href = '/pages/login.jsp';</script>");
  }
  // 是否有信息
  Object message = session.getAttribute("message");
  if (message != null) {
    out.println("<script>Toast('" + message.toString() + "')</script>");
  }
  session.removeAttribute("message");
%>
